package io.kiki.sba.registry.common.model.metaserver.nodes;

import io.kiki.sba.registry.common.model.store.Url;
import lombok.Getter;
import lombok.Setter;

import java.util.Objects;


@Setter
@Getter
public class DataStoreNode extends AbstractNode {

    private long registrationTimestamp;


    public DataStoreNode(Url nodeUrl, String dataCenter) {
        super(dataCenter, nodeUrl, null);
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (!(o instanceof DataStoreNode)) {
            return false;
        }

        DataStoreNode that = (DataStoreNode) o;
        return equal(that) && registrationTimestamp == that.registrationTimestamp;
    }


    @Override
    public int hashCode() {
        return Objects.hash(hash(), registrationTimestamp);
    }

    @Override
    public NodeType getNodeType() {
        return NodeType.data_store;
    }


}
